<?php if (!defined('THINK_PATH')) exit();?><!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>上海泛软科技有限公司-后台登陆</title>
<meta name="robots" content="nofollow" />
<meta name=”viewport” content=”width=device-width, initial-scale=1, maximum-scale=1″>
<link href="/Public/Css/admin-style.css" rel="stylesheet" type="text/css" />
<link href="/Public/Css/bootstrap.css" rel="stylesheet" type="text/css" />
<link href="/Public/Css/bootstrap.min.css" rel="stylesheet" type="text/css" />


<script language="javascript" type="text/javascript" src="/Public/Js/jquery.js"></script>
<script language="javascript" type="text/javascript" src="/Public/Js/admin-common.js"></script>
<script language="javascript" type="text/javascript" src="/Public/Js/bootstrap.min.js"></script>
<!--<script language="javascript" type="text/javascript" src="/Public/Js/bootstrap.js"></script> -->
<script language="javascript" type="text/javascript" src="/Public/Js/rock_customer_list.js"></script>
<script language="javascript" type="text/javascript" src="/Public/Js/demo.js"></script>
<script language="javascript" type="text/javascript" src="/Public/Js/blob.js"></script>
<script language="javascript" type="text/javascript" src="/Public/Js/FileSaver.min.js"></script>
<script language="javascript" type="text/javascript" src="/Public/Js/jquery.base64.js"></script>
<script language="javascript" type="text/javascript" src="/Public/Js/jquery-1.10.2.min.js"></script>
<script language="javascript" type="text/javascript" src="/Public/Js/tableExport.js"></script>
<script language="javascript" type="text/javascript" src="/Public/Js/xlsx.core.min.js"></script>
</head>

<body>


</style>
 <h4>设备警告修改</h4>
  <form class="form-horizontal" role="form" style="width:100%;" enctype="multipart/form-data" name="form1" method="post" action="<?php echo U('equipment_Modify_Ok');?>">
   <div style="width:80%; border: 1px solid #ccc;padding:10px;margin-bottom:30px;margin-left:10%"> 
	<div style="width:60%;margin-left:15%">  	 
	 <h4>修改信息:</h4>
	  <div class="form-group">
		<label for="firstname" class="col-sm-2 control-label">所属医院</label>
		<div class="col-sm-10">
         <?php if(is_array($hop_name)): $i = 0; $__LIST__ = $hop_name;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$hop_name): $mod = ($i % 2 );++$i;?><input readonly required="required" type="text" value="<?php echo ($hop_name['h_name']); ?>" class="form-control" name="equipment_hospaital" id="equipment_hospaital"><?php endforeach; endif; else: echo "" ;endif; ?>
		</div>
	  </div>
	   <div class="form-group">
		<label for="firstname" class="col-sm-2 control-label">设备编号</label>
		<div class="col-sm-10">
		  <input readonly required="required" type="text" class="form-control" name="equipment_no" id="equipment_no" >
		</div>
	  </div>
	   <div class="form-group">
		<label for="firstname" class="col-sm-2 control-label">设备标识</label>
		<div class="col-sm-10">
		  <input readonly required="required" type="text" class="form-control" name="equipment_name" id="equipment_name">
		</div>
	  </div>
	   <div class="form-group user_old"  >
		<label for="" class="col-sm-2 control-label">设备类型:</label>
		<div class="col-sm-10">
		  <select  style="width:100%" name="data_device_style" id="data_device_style" class="">
		   <?php if(is_array($equipment_Sty)): $i = 0; $__LIST__ = $equipment_Sty;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$equipment_Sty): $mod = ($i % 2 );++$i;?><option id="<?php echo ($equipment_Sty['d_id']); ?>"><?php echo ($equipment_Sty["d_style"]); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
		  </select>	
		  <input style="display:none"  type="text" name="device_sty" class="form-control" id="ds">
		
		</div>
	  </div>
	  <div class="form-group user_old1" >
		<label for="" class="col-sm-2 control-label">设备状态:</label>
		<div class="col-sm-10">
		  <select  style="width:100%" name="equipment_style" id="equipment_style">
			<?php if(is_array($equipment_styleD)): $i = 0; $__LIST__ = $equipment_styleD;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$equipment_styleD): $mod = ($i % 2 );++$i;?><option id="<?php echo ($equipment_styleD['d_id']); ?>"><?php echo ($equipment_styleD["d_status"]); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
		  </select>
		  <input style="display:none" required="required" type="text" name="status" class="form-control" id="status"> 
		
		</div>
	  </div>  
	   <div class="form-group user_old">
		<label for="" class="col-sm-2 control-label">最后上传用户:</label>
		<div class="col-sm-10">
		 
		  <select  style="width:100%" name="equipment_user" id="equipment_user" class="">
		    <?php if(is_array($hop_user)): $i = 0; $__LIST__ = $hop_user;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$hop_user): $mod = ($i % 2 );++$i;?><option u_id = "<?php echo ($hop_user['u_id']); ?>"><?php echo ($hop_user["u_realname"]); ?></option><?php endforeach; endif; else: echo "" ;endif; ?> 
		  </select>	
		   <input style="display:none" required="required" type="text" name="u" class="form-control" id="u">
		</div>  
	  </div>
	  <div class="form-group user_old" >
		<label for="" class="col-sm-2 control-label">最后上传时间:</label>
		<div class="col-sm-10">
		  <input required="required" type="text" name="equipment_time" class="form-control" id="equipment_time" placeholder="请输入上传时间">
		</div>
	  </div>
	 </div>
    </div> 
	<div class="form-group" style="text-align:right;margin-right:10%">
       <div class="col-sm-offset-2 col-sm-10">
         <button type="submit" class="btn btn-info sub_data">提交</button>
       </div>
    </div>
   <input style="display:none" required="required" type="text" name="eq_Modify" class="form-control" id="eq_Modify_Id">
 </form>
  <?php if(is_array($h_id)): $i = 0; $__LIST__ = $h_id;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$h_id): $mod = ($i % 2 );++$i;?><input style="display:none" required="required" type="text" name="h_id" class="form-control" id="h_id" value="<?php echo ($h_id); ?>"><?php endforeach; endif; else: echo "" ;endif; ?>
 <?php if(is_array($u_id)): $i = 0; $__LIST__ = $u_id;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$u_id): $mod = ($i % 2 );++$i;?><input style="display:none" required="required" type="text" name="u_id" class="form-control" id="u_id" value="<?php echo ($u_id); ?>"><?php endforeach; endif; else: echo "" ;endif; ?>
  <?php if(is_array($d_id)): $i = 0; $__LIST__ = $d_id;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$d_id): $mod = ($i % 2 );++$i;?><input style="display:none" required="required" type="text" name="d_id" class="form-control" id="d_id" value="<?php echo ($d_id); ?>"><?php endforeach; endif; else: echo "" ;endif; ?>
 
  
 <script>
  var h_id = document.getElementById('h_id').value;
  var u_id = document.getElementById('u_id').value;
  var d_id = document.getElementById('d_id').value;
  var user = document.getElementById("equipment_user");
  var equipment_no = document.getElementById("equipment_no");
  var equipment_name = document.getElementById("equipment_name");
  var equipment_style = document.getElementById("data_device_style");//leixing
  var equipment_status = document.getElementById("equipment_style");
  var eq_time = document.getElementById("equipment_time");
  var eqMOdity_id = document.getElementById("eq_Modify_Id");
  $("#equipment_user").children().each(function(){
    if($(this).attr("u_id") == u_id){
	  $(this).attr("selected",true);
	  $("#u").val(u_id);
	}
  })
  //修改的设备id
  eqMOdity_id.value = d_id;
  //设备的状态
  $("#equipment_style").change(function(){
     var status = $(this).find("option:selected").attr("id");
	 $("#status").val(status);
  });
  //最后上传用户
  $("#equipment_user").change(function(){
     var status = $(this).find("option:selected").attr("u_id");
	 $("#u").val(status);
  });
  //设备类型
  $("#data_device_style").change(function(){
    var status = $(this).find("option:selected").attr("id");
	$("#ds").val(status);
  })
  needModify();
 //需要修改的设备
 function needModify(){
    $.ajax({
  	    url: '/javajy/index.php/Admin/Wenlian/equipment_Modify',
  	    type: 'POST',
 	    dataType: 'JSON',//here
		data:{
		    d_id:d_id
		 },
 	     success: function(data){
		  debugger;
		  equipment_no.value = data[0]["d_number"];
		  equipment_name.value = data[0]["d_name"];
		  //设备类型
           $("#data_device_style").children().each(function(){
	       if(data[0]["d_style"] == $(this).attr("id")){
	          $(this).attr("selected",true);
			  $("#ds").val(data[0]["d_style"]);
	        }
          })
		  //设备状态
		   $("#equipment_style").children().each(function(){
	       if(data[0]["d_status"] == $(this).attr("id")){
	        $(this).attr("selected",true);
			$("#status").val(data[0]["d_status"]);
	        }
          })
		  //最后上传时间
		  eq_time.value = data[0]["update_time"];
		 }
    });
 }
 </script>

</body>
</html>